#include <iostream>

using namespace std;

long a[10000];
int n,Q;

void x1(long x,long v)
{
	a[x] = v;
}

long x2(long x)
{
	long ans = 1;
	for (long j = 1;j < x;j++)
	{
		if (a[x] >= a[j])
		{
			ans++;
		}
	}
	for (long j = x + 1;j <= n;j++)
	{
		if (a[x] > a[j])
		{
			ans++;
		}
	}
	return ans;
}

int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	
	long qn,qx,qv;
	
	cin >> n >> Q;
	
	for (long i = 1;i <= n;i++)
	{
		cin >> a[i];
	}
	
	for (long i = 1;i <= Q;i++)
	{
		cin >> qn;
		if (qn == 1)
		{
			cin >> qx >> qv;
			x1(qx,qv);
		}
		else if(qn == 2)
		{
			cin >> qx;
			cout << x2(qx) << endl;
		}
	}
	
	
	return 0;
}
